import requests
import json
from server.kb_api import create_kb,update_kb,show_kbs,delete_kb,load_kb
import configs


embedding_model = configs.EMBEDDING_MODEL

# 创建知识库
json_data = {"kb_name":'voyah_free_unstruct_turbo','embedding_model':embedding_model}
requests.post('http://localhost:8002/kb/create_kb', json=json_data)



create_kb('voyah_free_unstruct1', embedding_model)
update_kb(files='unstruct_db.txt',
          kb_name='voyah_free_unstruct',
          embedding_model=embedding_model,
          chunk_size=400,chunk_overlap = 10,
          split_str=' ---------- ')
show_kbs()
# delete_kb('voyah_free_unstruct')

db = load_kb(kb_name = 'voyah_free_unstruct',embedding_model=embedding_model)

